  import * as React from 'react';
  import '../style/test.css'

  interface IProps {
      color: string,
      size?: string,
  }
  interface IState {
      count: number,
      l:number,
      t:number,
      x:number,
      y:number
  }
  export default class Test extends React.Component<IProps, IState> {
     public txt:any;
     public fnClick(){
         alert(1);
     }
     public componentDidMount(): void {
         this.txt.addEventListener('click',this.fnClick);
         this.txt.removeEventListener('click',this.fnClick);
     }

      public render() {
          // const { color, size } = this.props;
          // const {count, l, t} = this.state;
          return (
              <div>
                  <button ref={ref=>this.txt=ref}>点击</button>
              </div>
          )
      }
  }
